# coding: utf-8
from enum import Enum

Month = Enum(
    "Month",
    (
        "Jan",
        "Feb",
        "Mar",
        "Apr",
        "May",
        "Jun",
        "Jul",
        "Aug",
        "Sep",
        "Oct",
        "Nov",
        "Dec",
    ),
)
# 可以直接使用Month.Jan 来引用一个常量
print(Month.Jan.value)

# 枚举所有成员:
for name, member in Month.__members__.items():
    print(name, "=>", member, ",", member.value)
# value属性则是自动赋给成员的int常量，默认从1开始计数。

print("--------------------------")


# 自定义value值
# coding: utf-8
class Month2(Enum):
    Jan = 0
    Feb = 1
    Mar = 2


print(Month2.Jan.value)
